<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
  </style>
</head>

<body>
  <canvas id="myCanvas" width="400" height="400"></canvas>

  <script>
    const myCanvas = document.getElementById('myCanvas');

    const ctx = myCanvas.getContext('2d');

    // setInterval(function () {
    //   draw();
    // }, 100);

    function draw() {
      ctx.clearRect(0, 0, 400, 400);

      let cp1x = 100;
      let cp1y = Math.floor(Math.random() * 50);
      let cp2x = 200;
      let cp2y = Math.floor(Math.random() * 50 + 50);

      ctx.beginPath();
      ctx.moveTo(0, 0);
      ctx.lineTo(50, 50);
      // ctx.quadraticCurveTo(55, 75, 100, 50);
      ctx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, 300, 50);

      ctx.stroke();
    }
  </script>
</body>

</html>